const Router = require('koa-router')
const { verifyToken } = require('@/utils/jwt')
const examHistoryValidate = require('@/middlewares/validateMiddlewares/examHistoryValidate')
const {
  validateSlideCode
} = require('@/middlewares/validateMiddlewares/userValidate')
const examHistoryController = require('@/controller/examHistoryController')

const router = new Router()

/**
 * 获取考试记录列表
 */
router.get(
  '/list',
  verifyToken(),
  examHistoryValidate.listExamHistoryValidate,
  examHistoryController.listExamHistory
)

/**
 * 创建考试记录列表
 */
router.post(
  '/create',
  verifyToken(),
  examHistoryValidate.createExamHistoryValidate,
  examHistoryController.createExamHistory
)

/**
 * 删除考试记录列表
 */
router.delete(
  '/delete',
  validateSlideCode(),
  verifyToken(),
  examHistoryValidate.delExamHistorysValidate,
  examHistoryController.delExamHistorys
)

/**
 * 考试记录排序
 */
router.put(
  '/sort',
  verifyToken(),
  examHistoryValidate.sortExamHistorysValidate,
  examHistoryController.sortExamHistorys
)

module.exports = router
